package com.jinzhi.jzweb.controller;

import com.alibaba.fastjson.JSON;
import com.jinzhi.jzweb.domain.InfoStoreDO;
import com.jinzhi.jzweb.domain.modelConfig.DeclareReadyDO;
import com.jinzhi.jzweb.service.modelConfig.DeclareReadyService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;
import java.util.Map;


@Controller
@RequestMapping("/jzweb")
public class DeclarationManagementController {
    @Autowired
    private DeclareReadyService declareReadyService;

    @GetMapping("/declarationManagement")
    String Index() {
        return "jzweb/declarationManagement/index";
    }

    @GetMapping("/declarationManagement/add")
    String Add(){
        return "jzweb/declarationManagement/add";
    }

    @GetMapping("/declarationManagement/infor/{id}")
    String Infor(@PathVariable("id") String id,Model model){
        model.addAttribute("myId", id);
        return "jzweb/declarationManagement/infor";
    }

    @GetMapping("/declarationManagement/look/{id}")
    String Look(@PathVariable("id") String id,Model model){
        DeclareReadyDO declareReady = declareReadyService.selectById(id);
        model.addAttribute("myDataRemark", declareReady.getRemark());
        declareReady.setRemark("");
        model.addAttribute("myData", declareReady);
        model.addAttribute("Look", true);
        return "jzweb/declarationManagement/add";
    }
    @GetMapping("/declarationManagement/edit/{id}")
    String Edit(@PathVariable("id") String id,Model model){
        DeclareReadyDO declareReady = declareReadyService.selectById(id);
        model.addAttribute("myDataRemark", declareReady.getRemark());
        declareReady.setRemark("");
        model.addAttribute("myData", declareReady);
        return "jzweb/declarationManagement/add";
    }

    @GetMapping("/declarationManagement/inforList/{id}")
    String InforList(@PathVariable("id") String id,Model model){
        model.addAttribute("myId", id);
        return "jzweb/declarationManagement/inforList";
    }
}
